From b0a0faf30a762700fb51d1ac9f7aa28624797151 Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Wed, 21 Feb 2007 23:03:00 +0000 Subject: [PATCH] Added VBD. and VIF.qos_supported_algorithms fields, with C bindings, Xend implementation to follow. Signed-off-by: Ewan Mellor --- docs/xen-api/xenapi-datamodel.tex | 72 +++++++++++++++++++++++++++++-- tools/libxen/include/xen_vbd.h | 9 ++++ tools/libxen/include/xen_vif.h | 9 ++++ tools/libxen/src/xen_vbd.c | 21 +++++++++ tools/libxen/src/xen_vif.c | 21 +++++++++ 5 files changed, 129 insertions(+), 3 deletions(-) diff --git a/docs/xen-api/xenapi-datamodel.tex b/docs/xen-api/xenapi-datamodel.tex index 82c3bea252..c2b7f452c0 100644 --- a/docs/xen-api/xenapi-datamodel.tex +++ b/docs/xen-api/xenapi-datamodel.tex @@ -6680,7 +6680,8 @@ $\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & virtual machine to which this $\mathit{RW}$ & {\tt MAC} & string & ethernet MAC address of virtual interface, as exposed to guest \\ $\mathit{RW}$ & {\tt MTU} & int & MTU in octets \\ $\mathit{RW}$ & {\tt qos/algorithm\_type} & string & QoS algorithm to use \\ -$\mathit{RW}$ & {\tt qos/algorithm\_params} & (string $\rightarrow$ string) Map & Paramters for chosen QoS algorithm \\ +$\mathit{RW}$ & {\tt qos/algorithm\_params} & (string $\rightarrow$ string) Map & parameters for chosen QoS algorithm \\ +$\mathit{RO}_\mathit{run}$ & {\tt qos/supported\_algorithms} & string Set & supported QoS algorithms for this VIF \\ $\mathit{RO}_\mathit{run}$ & {\tt metrics} & VIF\_metrics ref & metrics associated with this VIF. \\ \hline \end{longtable} @@ -7181,6 +7182,38 @@ void +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_qos\_supported\_algorithms} + +{\bf Overview:} +Get the qos/supported\_algorithms field of the given VIF. + + \noindent {\bf Signature:} +\begin{verbatim} (string Set) get_qos_supported_algorithms (session_id s, VIF ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt VIF ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +string Set +} + + +value of the field \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} @@ -9787,8 +9820,9 @@ $\mathit{RW}$ & {\tt bootable} & bool & true if this VBD is bootable \\ $\mathit{RW}$ & {\tt mode} & vbd\_mode & the mode the VBD should be mounted with \\ $\mathit{RW}$ & {\tt type} & vbd\_type & how the VBD will appear to the guest (e.g. disk or CD) \\ $\mathit{RW}$ & {\tt qos/algorithm\_type} & string & QoS algorithm to use \\ -$\mathit{RW}$ & {\tt qos/algorithm\_params} & (string $\rightarrow$ string) Map & Paramters for chosen QoS algorithm \\ -$\mathit{RO}_\mathit{run}$ & {\tt metrics} & VBD\_metrics ref & metrics associated with this VBD. \\ +$\mathit{RW}$ & {\tt qos/algorithm\_params} & (string $\rightarrow$ string) Map & parameters for chosen QoS algorithm \\ +$\mathit{RO}_\mathit{run}$ & {\tt qos/supported\_algorithms} & string Set & supported QoS algorithms for this VBD \\ +$\mathit{RO}_\mathit{run}$ & {\tt metrics} & VBD\_metrics ref & metrics associated with this VBD \\ \hline \end{longtable} \subsection{Additional RPCs associated with class: VBD} @@ -10389,6 +10423,38 @@ void +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_qos\_supported\_algorithms} + +{\bf Overview:} +Get the qos/supported\_algorithms field of the given VBD. + + \noindent {\bf Signature:} +\begin{verbatim} (string Set) get_qos_supported_algorithms (session_id s, VBD ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt VBD ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +string Set +} + + +value of the field \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} diff --git a/tools/libxen/include/xen_vbd.h b/tools/libxen/include/xen_vbd.h index 543a42288c..8489887605 100644 --- a/tools/libxen/include/xen_vbd.h +++ b/tools/libxen/include/xen_vbd.h @@ -20,6 +20,7 @@ #define XEN_VBD_H #include "xen_common.h" +#include "xen_string_set.h" #include "xen_string_string_map.h" #include "xen_vbd_decl.h" #include "xen_vbd_metrics_decl.h" @@ -77,6 +78,7 @@ typedef struct xen_vbd_record enum xen_vbd_type type; char *qos_algorithm_type; xen_string_string_map *qos_algorithm_params; + struct xen_string_set *qos_supported_algorithms; struct xen_vbd_metrics_record_opt *metrics; } xen_vbd_record; @@ -250,6 +252,13 @@ extern bool xen_vbd_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vbd vbd); +/** + * Get the qos/supported_algorithms field of the given VBD. + */ +extern bool +xen_vbd_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vbd vbd); + + /** * Get the metrics field of the given VBD. */ diff --git a/tools/libxen/include/xen_vif.h b/tools/libxen/include/xen_vif.h index c6ec71ee03..bf1ea1e23b 100644 --- a/tools/libxen/include/xen_vif.h +++ b/tools/libxen/include/xen_vif.h @@ -21,6 +21,7 @@ #include "xen_common.h" #include "xen_network_decl.h" +#include "xen_string_set.h" #include "xen_string_string_map.h" #include "xen_vif_decl.h" #include "xen_vif_metrics_decl.h" @@ -73,6 +74,7 @@ typedef struct xen_vif_record int64_t mtu; char *qos_algorithm_type; xen_string_string_map *qos_algorithm_params; + struct xen_string_set *qos_supported_algorithms; struct xen_vif_metrics_record_opt *metrics; } xen_vif_record; @@ -239,6 +241,13 @@ extern bool xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vif vif); +/** + * Get the qos/supported_algorithms field of the given VIF. + */ +extern bool +xen_vif_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vif vif); + + /** * Get the metrics field of the given VIF. */ diff --git a/tools/libxen/src/xen_vbd.c b/tools/libxen/src/xen_vbd.c index 5e0b14dfbb..d050ff2784 100644 --- a/tools/libxen/src/xen_vbd.c +++ b/tools/libxen/src/xen_vbd.c @@ -72,6 +72,9 @@ static const struct_member xen_vbd_record_struct_members[] = { .key = "qos_algorithm_params", .type = &abstract_type_string_string_map, .offset = offsetof(xen_vbd_record, qos_algorithm_params) }, + { .key = "qos_supported_algorithms", + .type = &abstract_type_string_set, + .offset = offsetof(xen_vbd_record, qos_supported_algorithms) }, { .key = "metrics", .type = &abstract_type_ref, .offset = offsetof(xen_vbd_record, metrics) } @@ -101,6 +104,7 @@ xen_vbd_record_free(xen_vbd_record *record) free(record->device); free(record->qos_algorithm_type); xen_string_string_map_free(record->qos_algorithm_params); + xen_string_set_free(record->qos_supported_algorithms); xen_vbd_metrics_record_opt_free(record->metrics); free(record); } @@ -308,6 +312,23 @@ xen_vbd_get_qos_algorithm_params(xen_session *session, xen_string_string_map **r } +bool +xen_vbd_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vbd vbd) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vbd } + }; + + abstract_type result_type = abstract_type_string_set; + + *result = NULL; + XEN_CALL_("VBD.get_qos_supported_algorithms"); + return session->ok; +} + + bool xen_vbd_get_metrics(xen_session *session, xen_vbd_metrics *result, xen_vbd vbd) { diff --git a/tools/libxen/src/xen_vif.c b/tools/libxen/src/xen_vif.c index 62a6ef16a2..3d7d2ad171 100644 --- a/tools/libxen/src/xen_vif.c +++ b/tools/libxen/src/xen_vif.c @@ -64,6 +64,9 @@ static const struct_member xen_vif_record_struct_members[] = { .key = "qos_algorithm_params", .type = &abstract_type_string_string_map, .offset = offsetof(xen_vif_record, qos_algorithm_params) }, + { .key = "qos_supported_algorithms", + .type = &abstract_type_string_set, + .offset = offsetof(xen_vif_record, qos_supported_algorithms) }, { .key = "metrics", .type = &abstract_type_ref, .offset = offsetof(xen_vif_record, metrics) } @@ -94,6 +97,7 @@ xen_vif_record_free(xen_vif_record *record) free(record->mac); free(record->qos_algorithm_type); xen_string_string_map_free(record->qos_algorithm_params); + xen_string_set_free(record->qos_supported_algorithms); xen_vif_metrics_record_opt_free(record->metrics); free(record); } @@ -288,6 +292,23 @@ xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map **r } +bool +xen_vif_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vif vif) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vif } + }; + + abstract_type result_type = abstract_type_string_set; + + *result = NULL; + XEN_CALL_("VIF.get_qos_supported_algorithms"); + return session->ok; +} + + bool xen_vif_get_metrics(xen_session *session, xen_vif_metrics *result, xen_vif vif) { -- 2.30.2